home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / CONTROLG.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  2KB  |  88 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1992, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.7  $
  6. //
  7. // Class TControlGadget definition. TControlGadget is a gadget that takes a
  8. // TWindow and allows it to be inserted into a gadget window. In effect it is
  9. // an adapter that allows arbitrary controls to be used like gadgets in a tool
  10. // bar, status bar, etc.
  11. //----------------------------------------------------------------------------
  12. #if !defined(OWL_CONTROLG_H)
  13. #define OWL_CONTROLG_H
  14.  
  15. #if !defined(OWL_GADGET_H)
  16. # include <owl/gadget.h>
  17. #endif
  18.  
  19. #if defined(BI_NAMESPACE)
  20. namespace OWL {
  21. #endif
  22.  
  23. // Generic definitions/compiler options (eg. alignment) preceeding the
  24. // definition of classes
  25. #include <services/preclass.h>
  26.  
  27. //
  28. // class TControlGadget
  29. // ~~~~~ ~~~~~~~~~~~~~~
  30. class _OWLCLASS TControlGadget : public TGadget {
  31.   public:
  32.     TControlGadget(TWindow& control, TBorderStyle = None);
  33.    ~TControlGadget();
  34.  
  35.   protected:
  36.     void           Created();
  37.     void           Inserted();
  38.     void           Removed();
  39.  
  40.     void           InvalidateRect(const TRect& rect, bool erase = true);
  41.     void           Update();  // Paint now if possible
  42.  
  43.     void           SetBounds(const TRect& rect);
  44.  
  45.     void           GetDesiredSize(TSize& size);
  46.  
  47.   public:
  48.     TWindow*       GetControl() const;
  49.     void           SetControl(TWindow* control);
  50.  
  51.   protected_data:
  52.     TWindow*       Control;
  53.  
  54.   private:
  55.     // Hidden to prevent accidental copying or assignment
  56.     //
  57.     TControlGadget(const TControlGadget&);
  58.     TControlGadget& operator =(const TControlGadget&);
  59. };
  60.  
  61. // Generic definitions/compiler options (eg. alignment) following the
  62. // definition of classes
  63. #include <services/posclass.h>
  64.  
  65. #if defined(BI_NAMESPACE)
  66. } // namespace OWL
  67. #endif
  68.  
  69. //----------------------------------------------------------------------------
  70. // Inline Implementations
  71. //
  72.  
  73. //
  74. // Return the control that is simulating a gadget.
  75. //
  76. inline TWindow* TControlGadget::GetControl() const {
  77.   return Control;
  78. }
  79.  
  80. //
  81. // Set the control that is simulating a gadget.
  82. //
  83. inline void TControlGadget::SetControl(TWindow* control) {
  84.   Control = control;
  85. }
  86.  
  87. #endif  // OWL_CONTROLG_H
  88.